
package com.be.beadmin.device.repository;

import com.be.beadmin.device.entity.InspectStandard;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

/**
* @author zhouzhou
* @date 2023-08-06
**/
public interface InspectStandardRepository extends JpaRepository<InspectStandard, String>, JpaSpecificationExecutor<InspectStandard> {

    InspectStandard findInspectStandardByIdAndDelete(String id, Integer delete);

    InspectStandard findInspectStandardById(String id);

    List<InspectStandard> findInspectStandardsByTemplateId(String TemplateID);

    @Query(value = "select distinct template_id from t_de_inspect_standard where is_delete=0", nativeQuery = true)
    List<String> findTemplateIds();

    @Query(value = "select check_item from t_de_inspect_standard where is_delete=0", nativeQuery = true)
    List<String> findCheckItems();

    @Query(value = "select check_desc from t_de_inspect_standard where check_item = ?", nativeQuery = true)
    String findCheckDescsByCheckItems(String checkItem);

}